package com.cj.search.mq;

import com.cj.search.constants.MqConstants;
import com.cj.search.service.ISearchService;
import com.cj.search.service.Impl.SearchService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author Hasee
 * @version 1.0
 * @description: TODO
 * @date 2023/3/19 15:17
 */
@Component
public class ItemListener {

    @Autowired
    private ISearchService iSearchService;

    @RabbitListener(queues = MqConstants.ITEM_INSERT_QUEUE)
    public void listenItemInsert(Long id){
        iSearchService.insertById(id);
    }
    @RabbitListener(queues = MqConstants.ITEM_DELETE_QUEUE)
    public void listenItemDelete(Long id){
        iSearchService.deleteById(id);
    }

}
